# -*- coding: utf-8 -*-
# @Time: 2021/8/5 8:18
# @File: problem-4-0.py
# @DESC: https://leetcode-cn.com/problems/median-of-two-sorted-arrays/


class Solution(object):
    def findMedianSortedArrays(self, nums1, nums2):
        """
        :type nums1: List[int]
        :type nums2: List[int]
        :rtype: float
        """
        nums = nums1 + nums2
        nums = sorted(nums)
        lent = len(nums)
        if lent % 2 == 0:
            index = int(lent / 2)
            return float((nums[index] + nums[index - 1]) / 2)
        else:
            return float(nums[int(lent / 2)])


if __name__ == "__main__":
    solution = Solution()
    nums1 = [1, 2]
    nums2 = [3, 4]
    result = solution.findMedianSortedArrays(nums1, nums2)
    print(result)
